class PunSub {
  constructor(subName) {
    this.subName = subName;
    this.subscribers = {};
  }
  on(name, fn) {
    if (!this.subscribers[name]) {
      this.subscribers[name] = [];
    }
    this.subscribers[name].push(fn);
  }
  emit(name, ...args) {
    this.subscribers[name].forEach((item) => {
      item.call(this, args);
    });
  }
}

const emitter = new PunSub("test");
console.log(emitter);

emitter.on("zks11", function (arg) {
  console.log("事件1", arg);
});
emitter.on("zks12222", function (arg) {
  console.log("事件2", arg);
});
emitter.emit("zks11", 111, 222);

emitter.emit("zks12222", 22222222, 22333333333332);
